<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>校园网自动登录脚本 | David 的博客</title><meta name="author" content="David"><meta name="copyright" content="David"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="校园网自动登录脚本">
<meta property="og:type" content="article">
<meta property="og:title" content="校园网自动登录脚本">
<meta property="og:url" content="https://blog.david-deng.cn/2023/12/30/%E6%A0%A1%E5%9B%AD%E7%BD%91%E8%87%AA%E5%8A%A8%E7%99%BB%E5%BD%95%E8%84%9A%E6%9C%AC/index.html">
<meta property="og:site_name" content="David 的博客">
<meta property="og:description" content="校园网自动登录脚本">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-9.png">
<meta property="article:published_time" content="2023-12-30T09:21:30.000Z">
<meta property="article:modified_time" content="2024-01-03T08:26:12.000Z">
<meta property="article:author" content="David">
<meta property="article:tag" content="python">
<meta property="article:tag" content="spider">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-9.png"><link rel="shortcut icon" href="/img/favicon.svg"><link rel="canonical" href="https://blog.david-deng.cn/2023/12/30/%E6%A0%A1%E5%9B%AD%E7%BD%91%E8%87%AA%E5%8A%A8%E7%99%BB%E5%BD%95%E8%84%9A%E6%9C%AC/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><script>
    (() => {
      
    const saveToLocal = {
      set: (key, value, ttl) => {
        if (!ttl) return
        const expiry = Date.now() + ttl * 86400000
        localStorage.setItem(key, JSON.stringify({ value, expiry }))
      },
      get: key => {
        const itemStr = localStorage.getItem(key)
        if (!itemStr) return undefined
        const { value, expiry } = JSON.parse(itemStr)
        if (Date.now() > expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return value
      }
    }

    window.btf = {
      saveToLocal,
      getScript: (url, attr = {}) => new Promise((resolve, reject) => {
        const script = document.createElement('script')
        script.src = url
        script.async = true
        Object.entries(attr).forEach(([key, val]) => script.setAttribute(key, val))
        script.onload = script.onreadystatechange = () => {
          if (!script.readyState || /loaded|complete/.test(script.readyState)) resolve()
        }
        script.onerror = reject
        document.head.appendChild(script)
      }),
      getCSS: (url, id) => new Promise((resolve, reject) => {
        const link = document.createElement('link')
        link.rel = 'stylesheet'
        link.href = url
        if (id) link.id = id
        link.onload = link.onreadystatechange = () => {
          if (!link.readyState || /loaded|complete/.test(link.readyState)) resolve()
        }
        link.onerror = reject
        document.head.appendChild(link)
      }),
      addGlobalFn: (key, fn, name = false, parent = window) => {
        if (!false && key.startsWith('pjax')) return
        const globalFn = parent.globalFn || {}
        globalFn[key] = globalFn[key] || {}
        globalFn[key][name || Object.keys(globalFn[key]).length] = fn
        parent.globalFn = globalFn
      }
    }
  
      
      const activateDarkMode = () => {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      const activateLightMode = () => {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }

      btf.activateDarkMode = activateDarkMode
      btf.activateLightMode = activateLightMode

      const theme = saveToLocal.get('theme')
    
          const mediaQueryDark = window.matchMedia('(prefers-color-scheme: dark)')
          const mediaQueryLight = window.matchMedia('(prefers-color-scheme: light)')
          
          if (theme === undefined) {
            if (mediaQueryLight.matches) activateLightMode()
            else if (mediaQueryDark.matches) activateDarkMode()
            else {
              const hour = new Date().getHours()
              const isNight = hour <= 6 || hour >= 18
              isNight ? activateDarkMode() : activateLightMode()
            }
            mediaQueryDark.addEventListener('change', () => {
              if (saveToLocal.get('theme') === undefined) {
                e.matches ? activateDarkMode() : activateLightMode()
              }
            })
          } else {
            theme === 'light' ? activateLightMode() : activateDarkMode()
          }
        
      
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        document.documentElement.classList.toggle('hide-aside', asideStatus === 'hide')
      }
    
      
    const detectApple = () => {
      if (/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)) {
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
  
    })()
  </script><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"简"},
  highlight: {"plugin":"highlight.js","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false,"highlightFullpage":false,"highlightMacStyle":false},
  copy: {
    success: '复制成功',
    error: '复制失败',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: true,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: David","link":"链接: ","source":"来源: David 的博客","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'null',
  Snackbar: {"chs_to_cht":"已切换为繁体中文","cht_to_chs":"已切换为简体中文","day_to_night":"已切换为深色模式","night_to_day":"已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"bottom-left"},
  infinitegrid: {
    js: 'https://cdn.jsdelivr.net/npm/@egjs/infinitegrid/dist/infinitegrid.min.js',
    buttonText: '加载更多'
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: true,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: true
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '校园网自动登录脚本',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  isShuoshuo: false
}</script><style type="text/css">#toggle-sidebar {bottom: 80px}</style><meta name="generator" content="Hexo 7.3.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img text-center"><img src="/img/avatar.png" onerror="onerror=null;src='/img/loading.gif'" alt="avatar"/></div><div class="site-data text-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">27</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">28</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">28</div></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><span class="site-page group"><i class="fa-fw fas fa-compass"></i><span> 目录</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url(https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-9.png);"><nav id="nav"><span id="blog-info"><a class="nav-site-title" href="/"><span class="site-name">David 的博客</span></a><a class="nav-page-title" href="/"><span class="site-name">校园网自动登录脚本</span></a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><span class="site-page group"><i class="fa-fw fas fa-compass"></i><span> 目录</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><span class="site-page"><i class="fas fa-bars fa-fw"></i></span></div></div></nav><div id="post-info"><h1 class="post-title">校园网自动登录脚本</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-12-30T09:21:30.000Z" title="发表于 2023-12-30 17:21:30">2023-12-30</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-01-03T08:26:12.000Z" title="更新于 2024-01-03 16:26:12">2024-01-03</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/spider/">spider</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/spider/python/">python</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">总字数:</span><span class="word-count">3.3k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>17分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title=""><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">浏览量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="container post-content" id="article-container"><div id="post-outdate-notice" data="{&quot;limitDay&quot;:90,&quot;messagePrev&quot;:&quot;文章距离最近一次更新已经&quot;,&quot;messageNext&quot;:&quot;天，文章的内容可能已经过期。&quot;,&quot;postUpdate&quot;:&quot;2024-01-03 16:26:12&quot;}" hidden></div><h1 id="校园网自动登录脚本"><a href="#校园网自动登录脚本" class="headerlink" title="校园网自动登录脚本"></a>校园网自动登录脚本</h1><h2 id="1-开发原因"><a href="#1-开发原因" class="headerlink" title="1. 开发原因"></a>1. 开发原因</h2><ol>
<li>组内的服务器联网存在一些问题，总是自动断网</li>
<li>手动联网比较缓慢，而且有时还容易失败</li>
<li>服务器联网对于安装依赖，安装软件等都是非常关键的</li>
</ol>
<h2 id="2-实现方法"><a href="#2-实现方法" class="headerlink" title="2. 实现方法"></a>2. 实现方法</h2><h3 id="2-1-使用-selenium-模拟登录-2"><a href="#2-1-使用-selenium-模拟登录-2" class="headerlink" title="2.1 使用 selenium 模拟登录^2"></a>2.1 使用 selenium 模拟登录<a href="%5B%E3%80%90python%E3%80%91%E8%87%AA%E5%8A%A8%E7%99%BB%E5%BD%95%E4%B8%AD%E7%A7%91%E5%A4%A7%E6%A0%A1%E5%9B%AD%E7%BD%91_%E4%B8%AD%E7%A7%91%E5%A4%A7%E7%BB%9F%E4%B8%80%E8%BA%AB%E4%BB%BD%E7%99%BB%E5%BD%95%E8%84%9A%E6%9C%AC-CSDN%E5%8D%9A%E5%AE%A2%5D(https://blog.csdn.net/qq_39534909/article/details/131523646)">^2</a></h3><blockquote>
<p>这种方法比较简单，而且成功的概率很大，基本就是<code>所见即所得</code>，能够看得到的页面都可以使用这种方法进行模拟登录</p>
<p>优点就是：代码简单，逻辑清晰，所见即所得</p>
<p>缺点就是：需要一些软件的配合，如果网站的页面发生改变需要重新写代码</p>
</blockquote>
<p><strong>参考代码如下</strong>：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> selenium <span class="keyword">import</span> webdriver</span><br><span class="line"><span class="keyword">from</span> selenium.webdriver.common.keys <span class="keyword">import</span> Keys</span><br><span class="line"><span class="keyword">from</span> selenium.webdriver.common.by <span class="keyword">import</span> By</span><br><span class="line"><span class="keyword">import</span> time</span><br><span class="line"><span class="keyword">import</span> subprocess</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">spider</span>():</span><br><span class="line">    driver = webdriver.Edge()</span><br><span class="line">    driver.get(<span class="string">&#x27;登录的网址&#x27;</span>)  <span class="comment"># 这里输入你的校园网登录网址</span></span><br><span class="line">    time.sleep(<span class="number">1</span>)</span><br><span class="line">    <span class="comment">#input_tag = driver.find_element(By.XPATH, &quot;//input[@type=&#x27;text&#x27; and @name=&#x27;username&#x27; and @id=&#x27;username&#x27; and @class=&#x27;from-control&#x27;]&quot;)  # 通过xpath确定账号框位置</span></span><br><span class="line">    input_tag = driver.find_element(By.XPATH, <span class="string">&quot;//input[ @type=&#x27;text&#x27; and @name=&#x27;username&#x27; and @id=&#x27;username&#x27; and @id=&#x27;username&#x27;]&quot;</span>)</span><br><span class="line">    input_tag.send_keys(<span class="string">&quot;你自己的账户&quot;</span>)  <span class="comment"># 输入账号</span></span><br><span class="line">    input_tag2 = driver.find_element(By.XPATH, <span class="string">&quot;//input[ @type=&#x27;password&#x27; and @name=&#x27;password&#x27; and  @id=&#x27;password&#x27;]&quot;</span>)  <span class="comment"># 通过xpath确定密码框位置</span></span><br><span class="line">    input_tag2.send_keys(<span class="string">&quot;你自己的密码&quot;</span>)  <span class="comment"># 输入密码</span></span><br><span class="line">    input_tag2.send_keys(Keys.ENTER)  <span class="comment"># 敲一下回车</span></span><br><span class="line">    time.sleep(<span class="number">1</span>)</span><br><span class="line">    input_tag3 = driver.find_element(By.XPATH, <span class="string">&quot;//button[@class=&#x27;btn btn-block btn-primary&#x27; and @id=&#x27;login&#x27; and @type=&#x27;button&#x27;]&quot;</span>)  <span class="comment"># 找到开通网络按钮</span></span><br><span class="line">    input_tag3.send_keys(Keys.ENTER)  <span class="comment"># 敲一下回车</span></span><br><span class="line">    time.sleep(<span class="number">1</span>)  <span class="comment"># 1秒后自动关闭浏览器</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 测试网络是否连通</span></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">Ping</span>():</span><br><span class="line">    backinfo = subprocess.call(<span class="string">&#x27;ping www.zhihu.com -n 1&#x27;</span>, shell=<span class="literal">True</span>, stdin=subprocess.PIPE, stdout=subprocess.PIPE,</span><br><span class="line">                               stderr=subprocess.PIPE)</span><br><span class="line">    <span class="keyword">if</span> backinfo:</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&#x27;网络未连接&#x27;</span>)</span><br><span class="line">        <span class="keyword">return</span> <span class="number">1</span></span><br><span class="line">    <span class="keyword">else</span>:</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;有网&quot;</span>)</span><br><span class="line">        <span class="keyword">return</span> <span class="number">2</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">&#x27;__main__&#x27;</span>:</span><br><span class="line">    spider()</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;连接网络中·····&quot;</span>)</span><br><span class="line">    connection = Ping()</span><br><span class="line">    <span class="keyword">if</span> connection == <span class="number">2</span>:</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;ping&quot;</span>)</span><br><span class="line">    <span class="keyword">elif</span> connection == <span class="number">1</span>:</span><br><span class="line">        spider()</span><br><span class="line">    exit()</span><br></pre></td></tr></table></figure>



<h3 id="2-2-使用-requests-请求登录接口-1"><a href="#2-2-使用-requests-请求登录接口-1" class="headerlink" title="2.2 使用 requests 请求登录接口^1"></a>2.2 使用 requests 请求登录接口<a href="%5B%E3%80%90python%E3%80%91%E8%87%AA%E5%8A%A8%E7%99%BB%E5%BD%95%E4%B8%AD%E7%A7%91%E5%A4%A7%E6%A0%A1%E5%9B%AD%E7%BD%91_%E4%B8%AD%E7%A7%91%E5%A4%A7%E7%BB%9F%E4%B8%80%E8%BA%AB%E4%BB%BD%E7%99%BB%E5%BD%95%E8%84%9A%E6%9C%AC-CSDN%E5%8D%9A%E5%AE%A2%5D(https://blog.csdn.net/qq_39534909/article/details/131523646)">^1</a></h3><blockquote>
<p>这种方法比较困难，而且成功的概率不大，需要一些技术手段找到网站后端的接口，然后破解后端的加密方法才能使用</p>
<p>优点就是：不需要其他软件的配合，执行速度快，执行效率高，不依赖网站的界面，网站界面修改后还能使用</p>
<p>缺点就是：需要一些JavaScript相关的知识，找到后端的接口，破解后端的加密方法，代码复杂，逻辑复杂</p>
</blockquote>
<p><strong>参考代码如下</strong>：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br><span class="line">325</span><br><span class="line">326</span><br><span class="line">327</span><br><span class="line">328</span><br><span class="line">329</span><br><span class="line">330</span><br><span class="line">331</span><br><span class="line">332</span><br><span class="line">333</span><br><span class="line">334</span><br><span class="line">335</span><br><span class="line">336</span><br><span class="line">337</span><br><span class="line">338</span><br><span class="line">339</span><br><span class="line">340</span><br><span class="line">341</span><br><span class="line">342</span><br><span class="line">343</span><br><span class="line">344</span><br><span class="line">345</span><br><span class="line">346</span><br><span class="line">347</span><br><span class="line">348</span><br><span class="line">349</span><br><span class="line">350</span><br><span class="line">351</span><br><span class="line">352</span><br><span class="line">353</span><br><span class="line">354</span><br><span class="line">355</span><br><span class="line">356</span><br><span class="line">357</span><br><span class="line">358</span><br><span class="line">359</span><br><span class="line">360</span><br><span class="line">361</span><br><span class="line">362</span><br><span class="line">363</span><br><span class="line">364</span><br><span class="line">365</span><br><span class="line">366</span><br><span class="line">367</span><br><span class="line">368</span><br><span class="line">369</span><br><span class="line">370</span><br><span class="line">371</span><br><span class="line">372</span><br><span class="line">373</span><br><span class="line">374</span><br><span class="line">375</span><br><span class="line">376</span><br><span class="line">377</span><br><span class="line">378</span><br><span class="line">379</span><br><span class="line">380</span><br><span class="line">381</span><br><span class="line">382</span><br><span class="line">383</span><br><span class="line">384</span><br><span class="line">385</span><br><span class="line">386</span><br><span class="line">387</span><br><span class="line">388</span><br><span class="line">389</span><br><span class="line">390</span><br><span class="line">391</span><br><span class="line">392</span><br><span class="line">393</span><br><span class="line">394</span><br><span class="line">395</span><br><span class="line">396</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># -*-coding: Utf-8 -*-</span></span><br><span class="line"><span class="comment"># @Packages: auto_srun-master</span></span><br><span class="line"><span class="comment"># @File : AutoLogin.py</span></span><br><span class="line"><span class="comment"># @Author: David</span></span><br><span class="line"><span class="comment"># @Date: 2023/12/30 15:07</span></span><br><span class="line"><span class="comment"># @Software: PyCharm</span></span><br><span class="line"><span class="keyword">import</span> hashlib</span><br><span class="line"><span class="keyword">import</span> hmac</span><br><span class="line"><span class="keyword">import</span> logging</span><br><span class="line"><span class="keyword">import</span> math</span><br><span class="line"><span class="keyword">import</span> re</span><br><span class="line"><span class="keyword">import</span> time</span><br><span class="line"><span class="keyword">from</span> logging <span class="keyword">import</span> Logger</span><br><span class="line"><span class="keyword">from</span> typing <span class="keyword">import</span> <span class="type">List</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> requests</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">get_logger</span>(<span class="params">is_log_to_file=<span class="literal">False</span></span>) -&gt; Logger:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    获取日志输出对象</span></span><br><span class="line"><span class="string">    :param is_log_to_file: 是否输出到日志文件中</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="comment"># 1、创建一个logger</span></span><br><span class="line">    log_obj = logging.getLogger(__name__)</span><br><span class="line">    log_obj.setLevel(logging.DEBUG)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 2、定义handler的输出格式（formatter）</span></span><br><span class="line">    formatter = logging.Formatter(<span class="string">&#x27;%(asctime)s - %(name)s - %(levelname)s - %(message)s&#x27;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 3. 创建一个handler，用于输出到控制台</span></span><br><span class="line">    ch = logging.StreamHandler()</span><br><span class="line">    ch.setLevel(logging.INFO)  <span class="comment"># 设置日志输出的等级</span></span><br><span class="line">    ch.setFormatter(formatter)  <span class="comment"># 设置日志输出格式</span></span><br><span class="line">    log_obj.addHandler(ch)  <span class="comment"># 将 handler 添加到 log_obj 中</span></span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> is_log_to_file:</span><br><span class="line">        <span class="comment"># 4. 创建一个handler，用于写入日志文件</span></span><br><span class="line">        fh = logging.FileHandler(<span class="string">&#x27;auto_login.log&#x27;</span>)</span><br><span class="line">        fh.setLevel(logging.DEBUG)  <span class="comment"># 设置日志输出的等级</span></span><br><span class="line">        fh.setFormatter(formatter)  <span class="comment"># 设置日志输出格式</span></span><br><span class="line">        log_obj.addHandler(fh)  <span class="comment"># 将 handler 添加到 log_obj 中</span></span><br><span class="line"></span><br><span class="line">    <span class="keyword">return</span> log_obj</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">logger_message</span>(<span class="params">message_key: <span class="built_in">str</span>, message_value: <span class="built_in">object</span>, level: <span class="built_in">str</span> = <span class="string">&#x27;info&#x27;</span></span>) -&gt; <span class="literal">None</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    输出日志</span></span><br><span class="line"><span class="string">    :param message_key:</span></span><br><span class="line"><span class="string">    :param message_value:</span></span><br><span class="line"><span class="string">    :param level:</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    message = <span class="string">f&quot;<span class="subst">&#123;message_key&#125;</span> &gt;&gt; <span class="subst">&#123;message_value&#125;</span>\n&quot;</span></span><br><span class="line">    <span class="keyword">if</span> level == <span class="string">&#x27;info&#x27;</span>:</span><br><span class="line">        logger.info(message)</span><br><span class="line">    <span class="keyword">elif</span> level == <span class="string">&#x27;debug&#x27;</span>:</span><br><span class="line">        logger.info(message)</span><br><span class="line">    <span class="keyword">else</span>:</span><br><span class="line">        logger.critical(message)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">get_byte</span>(<span class="params">s: <span class="built_in">str</span>, i: <span class="built_in">int</span></span>) -&gt; <span class="built_in">int</span>:</span><br><span class="line">    x = <span class="built_in">ord</span>(s[i])</span><br><span class="line">    <span class="keyword">if</span> x &gt; <span class="number">255</span>:</span><br><span class="line">        exit(<span class="number">0</span>)</span><br><span class="line">    <span class="keyword">return</span> x</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">get_base64</span>(<span class="params">s: <span class="built_in">str</span></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    base64 编码器</span></span><br><span class="line"><span class="string">    :param s:</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    pad_char = <span class="string">&quot;=&quot;</span></span><br><span class="line">    alpha = <span class="string">&quot;LVoJPiCN2R8G90yg+hmFHuacZ1OWMnrsSTXkYpUq/3dlbfKwv6xztjI7DeBE45QA&quot;</span></span><br><span class="line">    res = []</span><br><span class="line">    imax = <span class="built_in">len</span>(s) - <span class="built_in">len</span>(s) % <span class="number">3</span></span><br><span class="line">    <span class="keyword">if</span> <span class="built_in">len</span>(s) == <span class="number">0</span>:</span><br><span class="line">        <span class="keyword">return</span> s</span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">0</span>, imax, <span class="number">3</span>):</span><br><span class="line">        b10 = (get_byte(s, i) &lt;&lt; <span class="number">16</span>) | (get_byte(s, i + <span class="number">1</span>) &lt;&lt; <span class="number">8</span>) | get_byte(s, i + <span class="number">2</span>)</span><br><span class="line">        res.append(alpha[(b10 &gt;&gt; <span class="number">18</span>)])</span><br><span class="line">        res.append(alpha[((b10 &gt;&gt; <span class="number">12</span>) &amp; <span class="number">63</span>)])</span><br><span class="line">        res.append(alpha[((b10 &gt;&gt; <span class="number">6</span>) &amp; <span class="number">63</span>)])</span><br><span class="line">        res.append(alpha[(b10 &amp; <span class="number">63</span>)])</span><br><span class="line">    i = imax</span><br><span class="line">    <span class="keyword">if</span> <span class="built_in">len</span>(s) - imax == <span class="number">1</span>:</span><br><span class="line">        b10 = get_byte(s, i) &lt;&lt; <span class="number">16</span></span><br><span class="line">        res.append(alpha[(b10 &gt;&gt; <span class="number">18</span>)] + alpha[((b10 &gt;&gt; <span class="number">12</span>) &amp; <span class="number">63</span>)] + pad_char + pad_char)</span><br><span class="line">    <span class="keyword">else</span>:</span><br><span class="line">        b10 = (get_byte(s, i) &lt;&lt; <span class="number">16</span>) | (get_byte(s, i + <span class="number">1</span>) &lt;&lt; <span class="number">8</span>)</span><br><span class="line">        res.append(alpha[(b10 &gt;&gt; <span class="number">18</span>)] + alpha[((b10 &gt;&gt; <span class="number">12</span>) &amp; <span class="number">63</span>)] + alpha[((b10 &gt;&gt; <span class="number">6</span>) &amp; <span class="number">63</span>)] + pad_char)</span><br><span class="line">    <span class="keyword">return</span> <span class="string">&quot;&quot;</span>.join(res)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">get_md5</span>(<span class="params">password: <span class="built_in">str</span>, token: <span class="built_in">str</span></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    md5 编码器</span></span><br><span class="line"><span class="string">    :param password:</span></span><br><span class="line"><span class="string">    :param token:</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="keyword">return</span> hmac.new(token.encode(), password.encode(), hashlib.md5).hexdigest()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">get_sha1</span>(<span class="params">value: <span class="built_in">str</span></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    sha1 编码器</span></span><br><span class="line"><span class="string">    :param value:</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="keyword">return</span> hashlib.sha1(value.encode()).hexdigest()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">force</span>(<span class="params">msg</span>) -&gt; <span class="built_in">bytes</span>:</span><br><span class="line">    ret = []</span><br><span class="line">    <span class="keyword">for</span> w <span class="keyword">in</span> msg:</span><br><span class="line">        ret.append(<span class="built_in">ord</span>(w))</span><br><span class="line">    <span class="keyword">return</span> <span class="built_in">bytes</span>(ret)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">ordat</span>(<span class="params">msg: <span class="type">List</span>[<span class="built_in">str</span>], idx: <span class="built_in">int</span></span>) -&gt; <span class="built_in">int</span>:</span><br><span class="line">    <span class="keyword">if</span> <span class="built_in">len</span>(msg) &gt; idx:</span><br><span class="line">        <span class="keyword">return</span> <span class="built_in">ord</span>(msg[idx])</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">str_encode</span>(<span class="params">msg, key: <span class="built_in">bool</span></span>) -&gt; <span class="built_in">list</span>[<span class="built_in">int</span>]:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    编码器</span></span><br><span class="line"><span class="string">    :param msg:</span></span><br><span class="line"><span class="string">    :param key:</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    length = <span class="built_in">len</span>(msg)</span><br><span class="line">    pwd = []</span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">0</span>, length, <span class="number">4</span>):</span><br><span class="line">        pwd.append(</span><br><span class="line">            ordat(msg, i) | ordat(msg, i + <span class="number">1</span>) &lt;&lt; <span class="number">8</span> | ordat(msg, i + <span class="number">2</span>) &lt;&lt; <span class="number">16</span></span><br><span class="line">            | ordat(msg, i + <span class="number">3</span>) &lt;&lt; <span class="number">24</span>)</span><br><span class="line">    <span class="keyword">if</span> key:</span><br><span class="line">        pwd.append(length)</span><br><span class="line">    <span class="keyword">return</span> pwd</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">lencode</span>(<span class="params">msg, key: <span class="built_in">bool</span></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    编码器</span></span><br><span class="line"><span class="string">    :param msg:</span></span><br><span class="line"><span class="string">    :param key:</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    length = <span class="built_in">len</span>(msg)</span><br><span class="line">    ll = (length - <span class="number">1</span>) &lt;&lt; <span class="number">2</span></span><br><span class="line">    <span class="keyword">if</span> key:</span><br><span class="line">        m = msg[length - <span class="number">1</span>]</span><br><span class="line">        <span class="keyword">if</span> m &lt; ll - <span class="number">3</span> <span class="keyword">or</span> m &gt; ll:</span><br><span class="line">            <span class="keyword">return</span> <span class="string">&quot;&quot;</span></span><br><span class="line">        ll = m</span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">0</span>, length):</span><br><span class="line">        msg[i] = <span class="built_in">chr</span>(msg[i] &amp; <span class="number">0xff</span>) + <span class="built_in">chr</span>(msg[i] &gt;&gt; <span class="number">8</span> &amp; <span class="number">0xff</span>) + <span class="built_in">chr</span>(</span><br><span class="line">            msg[i] &gt;&gt; <span class="number">16</span> &amp; <span class="number">0xff</span>) + <span class="built_in">chr</span>(msg[i] &gt;&gt; <span class="number">24</span> &amp; <span class="number">0xff</span>)</span><br><span class="line">    <span class="keyword">if</span> key:</span><br><span class="line">        <span class="keyword">return</span> <span class="string">&quot;&quot;</span>.join(msg)[<span class="number">0</span>:ll]</span><br><span class="line">    <span class="keyword">return</span> <span class="string">&quot;&quot;</span>.join(msg)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">get_x_encode</span>(<span class="params">msg: <span class="built_in">str</span>, key: <span class="built_in">str</span></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    自定义编码器</span></span><br><span class="line"><span class="string">    :param msg:</span></span><br><span class="line"><span class="string">    :param key:</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="keyword">if</span> msg == <span class="string">&quot;&quot;</span>:</span><br><span class="line">        <span class="keyword">return</span> <span class="string">&quot;&quot;</span></span><br><span class="line">    pwd = str_encode(msg, <span class="literal">True</span>)</span><br><span class="line">    pwdk = str_encode(key, <span class="literal">False</span>)</span><br><span class="line">    <span class="keyword">if</span> <span class="built_in">len</span>(pwdk) &lt; <span class="number">4</span>:</span><br><span class="line">        pwdk = pwdk + [<span class="number">0</span>] * (<span class="number">4</span> - <span class="built_in">len</span>(pwdk))</span><br><span class="line">    n = <span class="built_in">len</span>(pwd) - <span class="number">1</span></span><br><span class="line">    z = pwd[n]</span><br><span class="line">    c = <span class="number">0x86014019</span> | <span class="number">0x183639A0</span></span><br><span class="line">    q = math.floor(<span class="number">6</span> + <span class="number">52</span> / (n + <span class="number">1</span>))</span><br><span class="line">    d = <span class="number">0</span></span><br><span class="line">    <span class="keyword">while</span> <span class="number">0</span> &lt; q:</span><br><span class="line">        d = d + c &amp; (<span class="number">0x8CE0D9BF</span> | <span class="number">0x731F2640</span>)</span><br><span class="line">        e = d &gt;&gt; <span class="number">2</span> &amp; <span class="number">3</span></span><br><span class="line">        p = <span class="number">0</span></span><br><span class="line">        <span class="keyword">while</span> p &lt; n:</span><br><span class="line">            y = pwd[p + <span class="number">1</span>]</span><br><span class="line">            m = z &gt;&gt; <span class="number">5</span> ^ y &lt;&lt; <span class="number">2</span></span><br><span class="line">            m = m + ((y &gt;&gt; <span class="number">3</span> ^ z &lt;&lt; <span class="number">4</span>) ^ (d ^ y))</span><br><span class="line">            m = m + (pwdk[(p &amp; <span class="number">3</span>) ^ e] ^ z)</span><br><span class="line">            pwd[p] = pwd[p] + m &amp; (<span class="number">0xEFB8D130</span> | <span class="number">0x10472ECF</span>)</span><br><span class="line">            z = pwd[p]</span><br><span class="line">            p = p + <span class="number">1</span></span><br><span class="line">        y = pwd[<span class="number">0</span>]</span><br><span class="line">        m = z &gt;&gt; <span class="number">5</span> ^ y &lt;&lt; <span class="number">2</span></span><br><span class="line">        m = m + ((y &gt;&gt; <span class="number">3</span> ^ z &lt;&lt; <span class="number">4</span>) ^ (d ^ y))</span><br><span class="line">        m = m + (pwdk[(p &amp; <span class="number">3</span>) ^ e] ^ z)</span><br><span class="line">        pwd[n] = pwd[n] + m &amp; (<span class="number">0xBB390742</span> | <span class="number">0x44C6F8BD</span>)</span><br><span class="line">        z = pwd[n]</span><br><span class="line">        q = q - <span class="number">1</span></span><br><span class="line">    <span class="keyword">return</span> lencode(pwd, <span class="literal">False</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">get_check_sum</span>(<span class="params">token: <span class="built_in">str</span>, username: <span class="built_in">str</span>, hmd5: <span class="built_in">str</span>, ac_id: <span class="built_in">str</span>, ip: <span class="built_in">str</span>, n: <span class="built_in">str</span>, type_str: <span class="built_in">str</span>, info: <span class="built_in">str</span></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    获取校验str</span></span><br><span class="line"><span class="string">    :param token:</span></span><br><span class="line"><span class="string">    :param username:</span></span><br><span class="line"><span class="string">    :param hmd5:</span></span><br><span class="line"><span class="string">    :param ac_id:</span></span><br><span class="line"><span class="string">    :param ip:</span></span><br><span class="line"><span class="string">    :param n:</span></span><br><span class="line"><span class="string">    :param type_str:</span></span><br><span class="line"><span class="string">    :param info:</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    check_str = <span class="string">f&quot;<span class="subst">&#123;token&#125;</span><span class="subst">&#123;username&#125;</span><span class="subst">&#123;token&#125;</span><span class="subst">&#123;hmd5&#125;</span><span class="subst">&#123;token&#125;</span><span class="subst">&#123;ac_id&#125;</span><span class="subst">&#123;token&#125;</span><span class="subst">&#123;ip&#125;</span><span class="subst">&#123;token&#125;</span><span class="subst">&#123;n&#125;</span><span class="subst">&#123;token&#125;</span><span class="subst">&#123;type_str&#125;</span><span class="subst">&#123;token&#125;</span><span class="subst">&#123;info&#125;</span>&quot;</span></span><br><span class="line">    logger_message(message_key=<span class="string">&quot;check str&quot;</span>, message_value=check_str, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    <span class="keyword">return</span> check_str</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">get_info</span>(<span class="params">username: <span class="built_in">str</span>, password: <span class="built_in">str</span>, ip: <span class="built_in">str</span>, ac_id: <span class="built_in">str</span>, enc: <span class="built_in">str</span></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    获取 info</span></span><br><span class="line"><span class="string">    :param username:</span></span><br><span class="line"><span class="string">    :param password:</span></span><br><span class="line"><span class="string">    :param ip:</span></span><br><span class="line"><span class="string">    :param ac_id:</span></span><br><span class="line"><span class="string">    :param enc:</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    info_temp = &#123;</span><br><span class="line">        <span class="string">&quot;username&quot;</span>: username,</span><br><span class="line">        <span class="string">&quot;password&quot;</span>: password,</span><br><span class="line">        <span class="string">&quot;ip&quot;</span>: ip,</span><br><span class="line">        <span class="string">&quot;acid&quot;</span>: ac_id,</span><br><span class="line">        <span class="string">&quot;enc_ver&quot;</span>: enc</span><br><span class="line">    &#125;</span><br><span class="line">    info = re.sub(<span class="string">&quot;&#x27;&quot;</span>, <span class="string">&#x27;&quot;&#x27;</span>, <span class="built_in">str</span>(info_temp))</span><br><span class="line">    info = re.sub(<span class="string">&quot; &quot;</span>, <span class="string">&#x27;&#x27;</span>, info)</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;info&quot;</span>, message_value=info, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    <span class="keyword">return</span> info</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">init_get_ip</span>(<span class="params">base_url: <span class="built_in">str</span>, headers: <span class="built_in">dict</span></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    获取 ip</span></span><br><span class="line"><span class="string">    :param base_url:</span></span><br><span class="line"><span class="string">    :param headers:</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    init_res = requests.get(base_url, headers=headers)</span><br><span class="line">    ip = re.search(<span class="string">&#x27;id=&quot;user_ip&quot; value=&quot;(.*?)&quot;&#x27;</span>, init_res.text).group(<span class="number">1</span>)</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;ip&quot;</span>, message_value=ip, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    <span class="keyword">return</span> ip</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">get_token</span>(<span class="params">username: <span class="built_in">str</span>, ip: <span class="built_in">str</span>, get_challenge_url: <span class="built_in">str</span>, headers: <span class="built_in">dict</span></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    get_challenge_params = &#123;</span><br><span class="line">        <span class="string">&quot;callback&quot;</span>: <span class="string">&quot;jQuery112404953340710317169_&quot;</span> + <span class="built_in">str</span>(<span class="built_in">int</span>(time.time() * <span class="number">1000</span>)),</span><br><span class="line">        <span class="string">&quot;username&quot;</span>: username,</span><br><span class="line">        <span class="string">&quot;ip&quot;</span>: ip,</span><br><span class="line">        <span class="string">&quot;_&quot;</span>: <span class="built_in">int</span>(time.time() * <span class="number">1000</span>),</span><br><span class="line">    &#125;</span><br><span class="line">    get_challenge_res = requests.get(get_challenge_url, params=get_challenge_params, headers=headers)</span><br><span class="line">    token = re.search(<span class="string">&#x27;&quot;challenge&quot;:&quot;(.*?)&quot;&#x27;</span>, get_challenge_res.text).group(<span class="number">1</span>)</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;params&quot;</span>, message_value=get_challenge_params, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;token&quot;</span>, message_value=token, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    <span class="keyword">return</span> token</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">do_login</span>(<span class="params"></span></span><br><span class="line"><span class="params">        username: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        hmd5: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        ac_id: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        ip: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        check_sum: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        info: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        n: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        type_str: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        srun_portal_url: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        headers: <span class="built_in">dict</span></span></span><br><span class="line"><span class="params"></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    srun_portal_params = &#123;</span><br><span class="line">        <span class="string">&#x27;callback&#x27;</span>: <span class="string">&#x27;jQuery11240645308969735664_&#x27;</span> + <span class="built_in">str</span>(<span class="built_in">int</span>(time.time() * <span class="number">1000</span>)),</span><br><span class="line">        <span class="string">&#x27;action&#x27;</span>: <span class="string">&#x27;login&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;username&#x27;</span>: username,</span><br><span class="line">        <span class="string">&#x27;password&#x27;</span>: <span class="string">&#x27;&#123;MD5&#125;&#x27;</span> + hmd5,</span><br><span class="line">        <span class="string">&#x27;ac_id&#x27;</span>: ac_id,</span><br><span class="line">        <span class="string">&#x27;ip&#x27;</span>: ip,</span><br><span class="line">        <span class="string">&#x27;chksum&#x27;</span>: check_sum,</span><br><span class="line">        <span class="string">&#x27;info&#x27;</span>: info,</span><br><span class="line">        <span class="string">&#x27;n&#x27;</span>: n,</span><br><span class="line">        <span class="string">&#x27;type&#x27;</span>: type_str,</span><br><span class="line">        <span class="string">&#x27;os&#x27;</span>: <span class="string">&#x27;Windows 10&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;name&#x27;</span>: <span class="string">&#x27;Windows&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;double_stack&#x27;</span>: <span class="string">&#x27;1&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;_&#x27;</span>: <span class="built_in">int</span>(time.time() * <span class="number">1000</span>)</span><br><span class="line">    &#125;</span><br><span class="line">    srun_portal_res = requests.get(srun_portal_url, params=srun_portal_params, headers=headers)</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;params&quot;</span>, message_value=srun_portal_params, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;response&quot;</span>, message_value=srun_portal_res.text, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    <span class="keyword">return</span> srun_portal_res.text</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">main</span>(<span class="params">config: <span class="built_in">dict</span></span>) -&gt; <span class="literal">None</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    主程序</span></span><br><span class="line"><span class="string">    :param config: 配置文件</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    ip = init_get_ip(base_url=config[<span class="string">&#x27;base_url&#x27;</span>], headers=config[<span class="string">&#x27;headers&#x27;</span>])</span><br><span class="line">    token = get_token(</span><br><span class="line">        username=config[<span class="string">&#x27;username&#x27;</span>],</span><br><span class="line">        ip=ip,</span><br><span class="line">        get_challenge_url=config[<span class="string">&quot;get_challenge_url&quot;</span>],</span><br><span class="line">        headers=config[<span class="string">&#x27;headers&#x27;</span>]</span><br><span class="line">    )</span><br><span class="line">    info = get_info(</span><br><span class="line">        username=config[<span class="string">&#x27;username&#x27;</span>],</span><br><span class="line">        password=config[<span class="string">&#x27;password&#x27;</span>],</span><br><span class="line">        ip=ip,</span><br><span class="line">        ac_id=config[<span class="string">&quot;ac_id&quot;</span>],</span><br><span class="line">        enc=config[<span class="string">&quot;enc&quot;</span>]</span><br><span class="line">    )</span><br><span class="line"></span><br><span class="line">    info = <span class="string">&quot;&#123;SRBX1&#125;&quot;</span> + get_base64(s=get_x_encode(msg=info, key=token))</span><br><span class="line">    hmd5 = get_md5(password=config[<span class="string">&#x27;password&#x27;</span>], token=token)</span><br><span class="line"></span><br><span class="line">    check_sum = get_check_sum(</span><br><span class="line">        token=token,</span><br><span class="line">        username=config[<span class="string">&#x27;username&#x27;</span>],</span><br><span class="line">        hmd5=hmd5,</span><br><span class="line">        ac_id=config[<span class="string">&quot;ac_id&quot;</span>],</span><br><span class="line">        ip=ip,</span><br><span class="line">        n=config[<span class="string">&quot;n&quot;</span>],</span><br><span class="line">        type_str=config[<span class="string">&quot;type&quot;</span>],</span><br><span class="line">        info=info</span><br><span class="line">    )</span><br><span class="line">    check_sum = get_sha1(check_sum)</span><br><span class="line"></span><br><span class="line">    do_login(</span><br><span class="line">        username=config[<span class="string">&#x27;username&#x27;</span>],</span><br><span class="line">        hmd5=hmd5,</span><br><span class="line">        ac_id=config[<span class="string">&quot;ac_id&quot;</span>],</span><br><span class="line">        ip=ip,</span><br><span class="line">        check_sum=check_sum,</span><br><span class="line">        info=info,</span><br><span class="line">        n=config[<span class="string">&quot;n&quot;</span>],</span><br><span class="line">        type_str=config[<span class="string">&quot;type&quot;</span>],</span><br><span class="line">        srun_portal_url=config[<span class="string">&quot;srun_portal_url&quot;</span>],</span><br><span class="line">        headers=config[<span class="string">&#x27;headers&#x27;</span>]</span><br><span class="line">    )</span><br><span class="line">    res = requests.get(config[<span class="string">&quot;get_info_url&quot;</span>], headers=config[<span class="string">&#x27;headers&#x27;</span>])</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;response&quot;</span>, message_value=res.text, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">get_config</span>() -&gt; <span class="built_in">dict</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    获取全局配置文件</span></span><br><span class="line"><span class="string">    :return: 配置文件</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    config = &#123;</span><br><span class="line">        <span class="string">&quot;username&quot;</span>: <span class="string">&quot;你的校园网账号&quot;</span>,</span><br><span class="line">        <span class="string">&quot;password&quot;</span>: <span class="string">&quot;你的校园网密码&quot;</span>,</span><br><span class="line">        <span class="string">&quot;headers&quot;</span>: &#123;</span><br><span class="line">            <span class="string">&quot;User-Agent&quot;</span>: <span class="string">&quot;Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.26 Safari/537.36&quot;</span></span><br><span class="line">        &#125;,</span><br><span class="line">        <span class="comment"># &quot;base_url&quot;: &quot;http://192.168.0.1/cgi-bin&quot;,</span></span><br><span class="line">        <span class="string">&quot;base_url&quot;</span>: <span class="string">&quot;校园网的基础地址，参考上面的链接&quot;</span>,</span><br><span class="line">        <span class="string">&quot;n&quot;</span>: <span class="string">&quot;200&quot;</span>,</span><br><span class="line">        <span class="string">&quot;type&quot;</span>: <span class="string">&quot;1&quot;</span>,</span><br><span class="line">        <span class="string">&quot;ac_id&quot;</span>: <span class="string">&quot;4&quot;</span>,</span><br><span class="line">        <span class="string">&quot;enc&quot;</span>: <span class="string">&quot;srun_bx1&quot;</span>,</span><br><span class="line">    &#125;</span><br><span class="line">    config[<span class="string">&quot;get_challenge_url&quot;</span>] = <span class="string">f&quot;<span class="subst">&#123;config[<span class="string">&#x27;base_url&#x27;</span>]&#125;</span>/get_challenge&quot;</span></span><br><span class="line">    config[<span class="string">&quot;srun_portal_url&quot;</span>] = <span class="string">f&quot;<span class="subst">&#123;config[<span class="string">&#x27;base_url&#x27;</span>]&#125;</span>/srun_portal&quot;</span></span><br><span class="line">    get_info_url = <span class="string">f&quot;<span class="subst">&#123;config[<span class="string">&#x27;base_url&#x27;</span>]&#125;</span>/rad_user_info?callback=jQuery112406118340540763985_1556004912581&amp;_=1556004912582&quot;</span></span><br><span class="line">    config[<span class="string">&quot;get_info_url&quot;</span>] = get_info_url</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;config&quot;</span>, message_value=config, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    <span class="keyword">return</span> config</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">&quot;__main__&quot;</span>:</span><br><span class="line">    logger = get_logger()</span><br><span class="line">    cfg = get_config()</span><br><span class="line">    main(config=cfg)</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="使用-requests-方式代码解析"><a href="#使用-requests-方式代码解析" class="headerlink" title="使用 requests 方式代码解析"></a>使用 requests 方式代码解析</h2><blockquote>
<p>本文借鉴了 <code>校园网自动登录Python版</code> <a href="%5B%E6%A0%A1%E5%9B%AD%E7%BD%91%E8%87%AA%E5%8A%A8%E7%99%BB%E5%BD%95Python%E7%89%88_%E6%B7%B1%E6%BE%9C%E8%BD%AF%E4%BB%B6%E6%A0%A1%E5%9B%AD%E7%BD%91%E8%87%AA%E5%8A%A8%E7%99%BB%E5%BD%95-CSDN%E5%8D%9A%E5%AE%A2%5D(https://blog.csdn.net/qq_20534023/article/details/124159181)">^1</a>博主的思路，基于该博主的代码进行了改进，博主的源码路径：<a target="_blank" rel="noopener external nofollow noreferrer" href="https://gitee.com/yshbcom/auto_srun">Gitee</a></p>
</blockquote>
<blockquote>
<p>首先，获取初始化的 <code>ip</code> 这是你在局域网中的<code>ip</code>地址，该地址隐藏在登录的界面中，具体的情况需要具体的分析。获取<code>ip</code>的代码如下：</p>
</blockquote>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">init_get_ip</span>(<span class="params">base_url: <span class="built_in">str</span>, headers: <span class="built_in">dict</span></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    获取 ip</span></span><br><span class="line"><span class="string">    :param base_url:</span></span><br><span class="line"><span class="string">    :param headers:</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    init_res = requests.get(base_url, headers=headers)</span><br><span class="line">    ip = re.search(<span class="string">&#x27;id=&quot;user_ip&quot; value=&quot;(.*?)&quot;&#x27;</span>, init_res.text).group(<span class="number">1</span>)</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;ip&quot;</span>, message_value=ip, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    <span class="keyword">return</span> ip</span><br></pre></td></tr></table></figure>

<blockquote>
<p>其次，获得登录时需要的<code>token</code>令牌，获取令牌时需要上一步获取到的<code>ip</code>才行，这是你登录时候的验证令牌，获取登录令牌的代码如下：</p>
</blockquote>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">get_token</span>(<span class="params">username: <span class="built_in">str</span>, ip: <span class="built_in">str</span>, get_challenge_url: <span class="built_in">str</span>, headers: <span class="built_in">dict</span></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    get_challenge_params = &#123;</span><br><span class="line">        <span class="string">&quot;callback&quot;</span>: <span class="string">&quot;jQuery112404953340710317169_&quot;</span> + <span class="built_in">str</span>(<span class="built_in">int</span>(time.time() * <span class="number">1000</span>)),</span><br><span class="line">        <span class="string">&quot;username&quot;</span>: username,</span><br><span class="line">        <span class="string">&quot;ip&quot;</span>: ip,</span><br><span class="line">        <span class="string">&quot;_&quot;</span>: <span class="built_in">int</span>(time.time() * <span class="number">1000</span>),</span><br><span class="line">    &#125;</span><br><span class="line">    get_challenge_res = requests.get(get_challenge_url, params=get_challenge_params, headers=headers)</span><br><span class="line">    token = re.search(<span class="string">&#x27;&quot;challenge&quot;:&quot;(.*?)&quot;&#x27;</span>, get_challenge_res.text).group(<span class="number">1</span>)</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;params&quot;</span>, message_value=get_challenge_params, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;token&quot;</span>, message_value=token, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    <span class="keyword">return</span> token</span><br></pre></td></tr></table></figure>

<blockquote>
<p>之后，需要获取你的登录信息，通过<code>username</code>，<code>password</code>，<code>ip</code>获取认证信息，获取认证信息的代码如下：</p>
</blockquote>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">get_info</span>(<span class="params">username: <span class="built_in">str</span>, password: <span class="built_in">str</span>, ip: <span class="built_in">str</span>, ac_id: <span class="built_in">str</span>, enc: <span class="built_in">str</span></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    获取 info</span></span><br><span class="line"><span class="string">    :param username:</span></span><br><span class="line"><span class="string">    :param password:</span></span><br><span class="line"><span class="string">    :param ip:</span></span><br><span class="line"><span class="string">    :param ac_id:</span></span><br><span class="line"><span class="string">    :param enc:</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    info_temp = &#123;</span><br><span class="line">        <span class="string">&quot;username&quot;</span>: username,</span><br><span class="line">        <span class="string">&quot;password&quot;</span>: password,</span><br><span class="line">        <span class="string">&quot;ip&quot;</span>: ip,</span><br><span class="line">        <span class="string">&quot;acid&quot;</span>: ac_id,</span><br><span class="line">        <span class="string">&quot;enc_ver&quot;</span>: enc</span><br><span class="line">    &#125;</span><br><span class="line">    info = re.sub(<span class="string">&quot;&#x27;&quot;</span>, <span class="string">&#x27;&quot;&#x27;</span>, <span class="built_in">str</span>(info_temp))</span><br><span class="line">    info = re.sub(<span class="string">&quot; &quot;</span>, <span class="string">&#x27;&#x27;</span>, info)</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;info&quot;</span>, message_value=info, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    <span class="keyword">return</span> info</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<blockquote>
<p>之后，获取登录时的校验和，校验和使用sha1算法加密，获取校验和的代码如下：</p>
</blockquote>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">get_check_sum</span>(<span class="params">token: <span class="built_in">str</span>, username: <span class="built_in">str</span>, hmd5: <span class="built_in">str</span>, ac_id: <span class="built_in">str</span>, ip: <span class="built_in">str</span>, n: <span class="built_in">str</span>, type_str: <span class="built_in">str</span>, info: <span class="built_in">str</span></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    获取校验str</span></span><br><span class="line"><span class="string">    :param token:</span></span><br><span class="line"><span class="string">    :param username:</span></span><br><span class="line"><span class="string">    :param hmd5:</span></span><br><span class="line"><span class="string">    :param ac_id:</span></span><br><span class="line"><span class="string">    :param ip:</span></span><br><span class="line"><span class="string">    :param n:</span></span><br><span class="line"><span class="string">    :param type_str:</span></span><br><span class="line"><span class="string">    :param info:</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    check_str = <span class="string">f&quot;<span class="subst">&#123;token&#125;</span><span class="subst">&#123;username&#125;</span><span class="subst">&#123;token&#125;</span><span class="subst">&#123;hmd5&#125;</span><span class="subst">&#123;token&#125;</span><span class="subst">&#123;ac_id&#125;</span><span class="subst">&#123;token&#125;</span><span class="subst">&#123;ip&#125;</span><span class="subst">&#123;token&#125;</span><span class="subst">&#123;n&#125;</span><span class="subst">&#123;token&#125;</span><span class="subst">&#123;type_str&#125;</span><span class="subst">&#123;token&#125;</span><span class="subst">&#123;info&#125;</span>&quot;</span></span><br><span class="line">    logger_message(message_key=<span class="string">&quot;check str&quot;</span>, message_value=check_str, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    <span class="keyword">return</span> check_str</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<blockquote>
<p> 最后，将上述所有的信息统一放入登录接口的参数中，即可完成登录的联网的功能，具体登录的方法代码如下：</p>
</blockquote>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">do_login</span>(<span class="params"></span></span><br><span class="line"><span class="params">        username: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        hmd5: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        ac_id: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        ip: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        check_sum: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        info: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        n: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        type_str: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        srun_portal_url: <span class="built_in">str</span>,</span></span><br><span class="line"><span class="params">        headers: <span class="built_in">dict</span></span></span><br><span class="line"><span class="params"></span>) -&gt; <span class="built_in">str</span>:</span><br><span class="line">    srun_portal_params = &#123;</span><br><span class="line">        <span class="string">&#x27;callback&#x27;</span>: <span class="string">&#x27;jQuery11240645308969735664_&#x27;</span> + <span class="built_in">str</span>(<span class="built_in">int</span>(time.time() * <span class="number">1000</span>)),</span><br><span class="line">        <span class="string">&#x27;action&#x27;</span>: <span class="string">&#x27;login&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;username&#x27;</span>: username,</span><br><span class="line">        <span class="string">&#x27;password&#x27;</span>: <span class="string">&#x27;&#123;MD5&#125;&#x27;</span> + hmd5,</span><br><span class="line">        <span class="string">&#x27;ac_id&#x27;</span>: ac_id,</span><br><span class="line">        <span class="string">&#x27;ip&#x27;</span>: ip,</span><br><span class="line">        <span class="string">&#x27;chksum&#x27;</span>: check_sum,</span><br><span class="line">        <span class="string">&#x27;info&#x27;</span>: info,</span><br><span class="line">        <span class="string">&#x27;n&#x27;</span>: n,</span><br><span class="line">        <span class="string">&#x27;type&#x27;</span>: type_str,</span><br><span class="line">        <span class="string">&#x27;os&#x27;</span>: <span class="string">&#x27;Windows 10&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;name&#x27;</span>: <span class="string">&#x27;Windows&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;double_stack&#x27;</span>: <span class="string">&#x27;1&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;_&#x27;</span>: <span class="built_in">int</span>(time.time() * <span class="number">1000</span>)</span><br><span class="line">    &#125;</span><br><span class="line">    srun_portal_res = requests.get(srun_portal_url, params=srun_portal_params, headers=headers)</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;params&quot;</span>, message_value=srun_portal_params, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    logger_message(message_key=<span class="string">&quot;response&quot;</span>, message_value=srun_portal_res.text, level=<span class="string">&quot;info&quot;</span>)</span><br><span class="line">    <span class="keyword">return</span> srun_portal_res.text</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<blockquote>
<p>总结：使用 <code>requests </code>方式需要清楚的了解后端的接口参数，已经参数使用何种方式进行加密，这需要一定的<code>JavaScript</code>能力，所以相比于使用 <code>selenium </code>方法更加的复杂，逻辑也更加的复杂。但是使用 <code>requests </code>代码的效率更高，对于网站的界面没有依赖，所以网站界面修改后也可以使用，泛化能力较强。</p>
</blockquote>
<h2 id="3-参考链接"><a href="#3-参考链接" class="headerlink" title="3. 参考链接"></a>3. 参考链接</h2></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="https://blog.david-deng.cn">David</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="https://blog.david-deng.cn/2023/12/30/%E6%A0%A1%E5%9B%AD%E7%BD%91%E8%87%AA%E5%8A%A8%E7%99%BB%E5%BD%95%E8%84%9A%E6%9C%AC/">https://blog.david-deng.cn/2023/12/30/校园网自动登录脚本/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow noreferrer" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来源 <a href="https://blog.david-deng.cn" target="_blank">David 的博客</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/python/">python</a><a class="post-meta__tags" href="/tags/spider/">spider</a></div><div class="post-share"><div class="social-share" data-image="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-9.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i>赞助</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://cdn.jsdelivr.net/gh/David-deng-01/images/blog/WeChatPay.jpg" rel="external nofollow noreferrer" target="_blank"><img class="post-qr-code-img" src="https://cdn.jsdelivr.net/gh/David-deng-01/images/blog/WeChatPay.jpg" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="https://cdn.jsdelivr.net/gh/David-deng-01/images/blog/Alipay.jpg" rel="external nofollow noreferrer" target="_blank"><img class="post-qr-code-img" src="https://cdn.jsdelivr.net/gh/David-deng-01/images/blog/Alipay.jpg" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><nav class="pagination-post" id="pagination"><a class="pagination-related" href="/2023/11/24/%E5%A4%9A%E6%A8%A1%E6%80%81%E8%AE%BD%E5%88%BA%E8%AF%86%E5%88%AB%E5%9F%BA%E7%BA%BF%E6%A8%A1%E5%9E%8B%E5%A4%8D%E7%8E%B0/" title="多模态讽刺识别基线模型复现"><img class="cover" src="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-10.png" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="info"><div class="info-1"><div class="info-item-1">上一篇</div><div class="info-item-2">多模态讽刺识别基线模型复现</div></div><div class="info-2"><div class="info-item-1">多模态讽刺识别基线模型复现</div></div></div></a><a class="pagination-related" href="/2024/01/04/2024-01-05%20%E5%A4%9A%E6%A8%A1%E6%80%81%E6%A8%A1%E5%9E%8B%E7%BB%BC%E8%BF%B0/" title="多模态基础模型：从专家到通用助理"><img class="cover" src="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-7.png" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="info text-right"><div class="info-1"><div class="info-item-1">下一篇</div><div class="info-item-2">多模态基础模型：从专家到通用助理</div></div><div class="info-2"><div class="info-item-1">多模态大模型综述</div></div></div></a></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><a class="pagination-related" href="/2023/10/28/heapq-%E5%A0%86%E9%98%9F%E5%88%97%E7%AE%97%E6%B3%95/" title="heapq 堆队列算法"><img class="cover" src="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-7.png" alt="cover"><div class="info text-center"><div class="info-1"><div class="info-item-1"><i class="far fa-calendar-alt fa-fw"></i> 2023-10-28</div><div class="info-item-2">heapq 堆队列算法</div></div><div class="info-2"><div class="info-item-1">Python heapq 堆队列算法模块解释说明源码：Lib&#x2F;heapq.py  这个模块实现了堆队列算法，即优先队列算法。 堆是一棵完全二叉树，其中每个节点的值都小于等于其各个子节点的值。这个使用数组的实现，索引从 0 开始，且对所有的 k 都有 heap[k] &lt;= heap[2*k+1] 和 heap[k] &lt;= heap[2*k+2]。比较时不存在的元素被认为是无限大。堆最有趣的特性在于最小的元素总是在根结点：heap[0]。 这个API与教材的堆算法实现有所不同，具体区别有两方面：（a）我们使用了从零开始的索引。这使得节点和其孩子节点索引之间的关系不太直观但更加适合，因为 Python 使用从零开始的索引。 （b）我们的 pop 方法返回最小的项而不是最大的项（这在教材中称为“最小堆”；而“最大堆”在教材中更为常见，因为它更适用于原地排序）。 基于这两方面，把堆看作原生的Python list也没什么奇怪的： heap[0] 表示最小的元素，同时 heap.sort() 维护了堆的不变性！ 要创建一个堆，可以新建一个空列表 []，或者用函数...</div></div></div></a></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info text-center"><div class="avatar-img"><img src="/img/avatar.png" onerror="this.onerror=null;this.src='/img/loading.gif'" alt="avatar"/></div><div class="author-info-name">David</div><div class="author-info-description">Welcome to David's Blog</div><div class="site-data"><a href="/archives/"><div class="headline">文章</div><div class="length-num">27</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">28</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">28</div></a></div><a id="card-info-btn" target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/david-deng-01"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons"><a class="social-icon" href="https://github.com/david-deng-01" rel="external nofollow noreferrer" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="https://blog.csdn.net/David_0925" rel="external nofollow noreferrer" target="_blank" title="CSDN"><i class="fa fa-book-open"></i></a><a class="social-icon" href="tencent://AddContact/?fromId=45&amp;fromSubId=1&amp;subcmd=all&amp;uin=635647792&amp;website=www.oicqzone.com" rel="external nofollow noreferrer" target="_blank" title="QQ"><i class="fab fa-qq"></i></a><a class="social-icon" href="mailto:david-deng-0925@qq.com" rel="external nofollow noreferrer" target="_blank" title="Email"><i class="fas fa-envelope-open-text"></i></a></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%A0%A1%E5%9B%AD%E7%BD%91%E8%87%AA%E5%8A%A8%E7%99%BB%E5%BD%95%E8%84%9A%E6%9C%AC"><span class="toc-number">1.</span> <span class="toc-text">校园网自动登录脚本</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E5%BC%80%E5%8F%91%E5%8E%9F%E5%9B%A0"><span class="toc-number">1.1.</span> <span class="toc-text">1. 开发原因</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E5%AE%9E%E7%8E%B0%E6%96%B9%E6%B3%95"><span class="toc-number">1.2.</span> <span class="toc-text">2. 实现方法</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#2-1-%E4%BD%BF%E7%94%A8-selenium-%E6%A8%A1%E6%8B%9F%E7%99%BB%E5%BD%95-2"><span class="toc-number">1.2.1.</span> <span class="toc-text">2.1 使用 selenium 模拟登录^2</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-2-%E4%BD%BF%E7%94%A8-requests-%E8%AF%B7%E6%B1%82%E7%99%BB%E5%BD%95%E6%8E%A5%E5%8F%A3-1"><span class="toc-number">1.2.2.</span> <span class="toc-text">2.2 使用 requests 请求登录接口^1</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-requests-%E6%96%B9%E5%BC%8F%E4%BB%A3%E7%A0%81%E8%A7%A3%E6%9E%90"><span class="toc-number">1.3.</span> <span class="toc-text">使用 requests 方式代码解析</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-%E5%8F%82%E8%80%83%E9%93%BE%E6%8E%A5"><span class="toc-number">1.4.</span> <span class="toc-text">3. 参考链接</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2025/01/05/other-%E9%9A%8F%E7%AC%94-icarus-%E4%B8%BB%E9%A2%98%E5%AE%89%E8%A3%85/" title="Hexo 配置 Icarus 主题"><img src="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-4.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Hexo 配置 Icarus 主题"/></a><div class="content"><a class="title" href="/2025/01/05/other-%E9%9A%8F%E7%AC%94-icarus-%E4%B8%BB%E9%A2%98%E5%AE%89%E8%A3%85/" title="Hexo 配置 Icarus 主题">Hexo 配置 Icarus 主题</a><time datetime="2025-01-05T08:25:00.000Z" title="发表于 2025-01-05 16:25:00">2025-01-05</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2024/03/18/other-leetcode-%E3%80%902024-03-18-LeetCode-%E5%88%B7%E9%A2%98-400%E9%81%93%E6%89%93%E5%8D%A1%E3%80%91/" title="LeetCode刷题400道打卡"><img src="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-9.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="LeetCode刷题400道打卡"/></a><div class="content"><a class="title" href="/2024/03/18/other-leetcode-%E3%80%902024-03-18-LeetCode-%E5%88%B7%E9%A2%98-400%E9%81%93%E6%89%93%E5%8D%A1%E3%80%91/" title="LeetCode刷题400道打卡">LeetCode刷题400道打卡</a><time datetime="2024-03-17T16:00:00.000Z" title="发表于 2024-03-18 00:00:00">2024-03-18</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2024/01/04/2024-01-05%20%E5%A4%9A%E6%A8%A1%E6%80%81%E6%A8%A1%E5%9E%8B%E7%BB%BC%E8%BF%B0/" title="多模态基础模型：从专家到通用助理"><img src="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-7.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="多模态基础模型：从专家到通用助理"/></a><div class="content"><a class="title" href="/2024/01/04/2024-01-05%20%E5%A4%9A%E6%A8%A1%E6%80%81%E6%A8%A1%E5%9E%8B%E7%BB%BC%E8%BF%B0/" title="多模态基础模型：从专家到通用助理">多模态基础模型：从专家到通用助理</a><time datetime="2024-01-04T14:42:08.000Z" title="发表于 2024-01-04 22:42:08">2024-01-04</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/12/30/%E6%A0%A1%E5%9B%AD%E7%BD%91%E8%87%AA%E5%8A%A8%E7%99%BB%E5%BD%95%E8%84%9A%E6%9C%AC/" title="校园网自动登录脚本"><img src="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-9.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="校园网自动登录脚本"/></a><div class="content"><a class="title" href="/2023/12/30/%E6%A0%A1%E5%9B%AD%E7%BD%91%E8%87%AA%E5%8A%A8%E7%99%BB%E5%BD%95%E8%84%9A%E6%9C%AC/" title="校园网自动登录脚本">校园网自动登录脚本</a><time datetime="2023-12-30T09:21:30.000Z" title="发表于 2023-12-30 17:21:30">2023-12-30</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/11/24/%E5%A4%9A%E6%A8%A1%E6%80%81%E8%AE%BD%E5%88%BA%E8%AF%86%E5%88%AB%E5%9F%BA%E7%BA%BF%E6%A8%A1%E5%9E%8B%E5%A4%8D%E7%8E%B0/" title="多模态讽刺识别基线模型复现"><img src="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-10.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="多模态讽刺识别基线模型复现"/></a><div class="content"><a class="title" href="/2023/11/24/%E5%A4%9A%E6%A8%A1%E6%80%81%E8%AE%BD%E5%88%BA%E8%AF%86%E5%88%AB%E5%9F%BA%E7%BA%BF%E6%A8%A1%E5%9E%8B%E5%A4%8D%E7%8E%B0/" title="多模态讽刺识别基线模型复现">多模态讽刺识别基线模型复现</a><time datetime="2023-11-24T08:51:18.000Z" title="发表于 2023-11-24 16:51:18">2023-11-24</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2022 - 2025 By David</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener external nofollow noreferrer" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text"><a href="http://www.beian.gov.cn/portal/registerSystemInfo" rel="external nofollow noreferrer" target="_blank"> <img style="vertical-align:middle; width:20px; " src="https://cdn.jsdelivr.net/gh/David-deng-01/images/blog/icp.png"> 赣公网安备36082302000135号</a> <a href="https://beian.miit.gov.cn/" rel="external nofollow noreferrer" id="beian"  target="_blank">赣ICP备2023013705号-1</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="日间和夜间模式切换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><div class="js-pjax"></div><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-nest.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>